package com.newhis.service.login.impl;

import com.newhis.event.LoginEvent;
import com.newhis.service.login.LoginService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;

@Service
public class LoginServiceImpl implements LoginService {
    private static final Logger log = LoggerFactory.getLogger(LoginServiceImpl.class);
    @Autowired
    private ApplicationEventPublisher applicationEventPublisher;
    @Override
    public void login(String username, String password) {
        log.info("用户登录成功：{}", username);
        LoginEvent loginEvent = new LoginEvent(this, username, password);
        applicationEventPublisher.publishEvent(loginEvent);
    }
}
